﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data;
using Telerik.Web.UI;
using KPIS.GERP.GBMS.BLL;

namespace KPIS.GERP.GBMS.APP_UI.Form
{
    public partial class BGM_Project_Information : System.Web.UI.Page
    {
        ProjectInformationBLL bal = new ProjectInformationBLL();
        DataSet ds;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ds = this.bal.GetDataProjectInfomationForGrid(2553);
                Session["ds"] = this.ds;
                Grid.DataSource = ds.Tables[0];
                Grid.Columns[4].Visible = false;
                GridGroupByExpression g = new GridGroupByExpression(Grid.Columns[4]);
                Grid.MasterTableView.GroupByExpressions.Add(g);
                Grid.DataBind();
            }
            else
            {
                this.ds = (DataSet)Session["ds"];
            }
        }

        protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                GridGroupByExpression g;
                Grid.DataSource = this.ds.Tables[0];
                if (RadioButton1.Checked)
                {
                    Grid.MasterTableView.GroupByExpressions.Clear();
                    g = new GridGroupByExpression(Grid.Columns[4]);
                    Grid.MasterTableView.GroupByExpressions.Add(g);
                    Grid.Columns[4].Visible = false;
                    Grid.Columns[5].Visible = true;
                }
                Grid.DataBind();
            }
            catch
            {

            }
        }

        protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                GridGroupByExpression g;
                Grid.DataSource = this.ds.Tables[0];
                if (RadioButton2.Checked)
                {
                    Grid.MasterTableView.GroupByExpressions.Clear();
                    g = new GridGroupByExpression(Grid.Columns[5]);
                    Grid.MasterTableView.GroupByExpressions.Add(g);
                    Grid.Columns[4].Visible = true;
                    Grid.Columns[5].Visible = false;
                }
                Grid.DataBind();
            }
            catch
            {

            }
        }
    }
}
